Dithered sampling patterns for temporal color averaging

ABSTRACT

Graphics processing is performed in which a decision is made in individual tiles whether or not to sample at a reduced sampling rate. A sampling pattern is selected from a set of sampling patterns having the same reduced sampling rate. The sampling pattern is dithered over a set of frames to reduce the visual appearance of visual artifacts via temporal color averaging.

CROSS REFERENCE TO RELATED APPLICATIONS

The present application claims the benefit of U.S. Provisional PatentApplication No. 62/018,221, filed Jun. 27, 2014; U.S. Provisional PatentApplication No. 62/018,228, filed Jun. 27, 2014; U.S. Provisional PatentApplication No. 62/018,254 filed Jun. 27, 2014; and U.S. ProvisionalPatent Application No. 62/018,274, filed Jun. 27, 2014, the contents ofeach of which are hereby incorporated by reference.

FIELD OF THE INVENTION

An embodiment of the present invention is generally related totechniques of performing graphics processing in which a sampling rate isreduced. More particularly, an embodiment of the present invention isdirected to reducing a visual appearance of visual artifacts associatedwith a reduced sample rate by dithering a sample pattern.

BACKGROUND OF THE INVENTION

FIG. 1 illustrates major portions of a graphics pipeline 100 based onthe OpenGL® 3.0 standard. An illustrative set of stages includes avertex shader operations stage 105, a primitive assembly andrasterization stage 110, a fragment pixel shader operations stage 115, aframe buffer stage 120, and a texture memory 125. The pipeline operatesto receive vertex data, shade vertices, assemble and rasterizeprimitives, and perform shading operations on fragments/pixels.

One aspect of the graphics pipeline 100 is that every region of an imageis rendered at the same minimum resolution. In particular, in aconventional graphics pipeline a sampling rate (average number ofsamples per pixel) is typically at least one sample for every pixel ofan image.

One aspect of the conventional graphics pipeline is that it is wastefuland requires more pixel shading operations then desired. In particular,there is no automation in the graphics pipeline to permit strategicchoices to be automatically made to reduce a sampling rate below onesample per pixel (sub-sampling/de-sampling) in local regions of animage. In the context of mobile devices this means that the amount ofpower that is consumed in larger than desired.

SUMMARY OF THE INVENTION

In a graphics system there are applications in which it may be desirableto reduce a pixel sampling rate in local regions of a frame in order tosave power or for other reasons. However, reducing the sampling rate hasthe potential to result in visual artifacts noticeable by a humanviewer. A graphics apparatus, system, and method makes decision whetheror not individual tiles are to be sampled at a reduced sampling rate. Asampling pattern is selected from a set of sampling patterns having thesame reduced sampling rate but a different arrangement of samplinglocations in a block of pixels. The sampling pattern is dithered over aset of frames to reduce the visual appearance of visual artifacts viatemporal color averaging.

One embodiment of a method includes selecting, on a frame-by-frame basisfor a sequence of frames, a selection of tiles in which the tiles aresparsely sampled at an average sample rate of less than one sample perpixel. A sampling pattern is selected for each tile in a frame from aset of different sampling patterns having the same average samplingrate. The sampling pattern is varied in individual tiles over a sequenceof frames to temporally color average sampling artifacts. In oneembodiment the sampling pattern is varied over a sequence of frames in aschedule selected to ensure that every pixel is sampled at least onceover a set of frames.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 illustrates a conventional graphics pipeline.

FIG. 2 illustrates a graphics pipeline in accordance with an embodimentof the present invention.

FIG. 3 illustrates an adaptive desampling generator in accordance withan embodiment of the present invention.

FIG. 4 illustrates an example of pixel speed considerations inperforming adaptive rendering in accordance with an embodiment of thepresent invention.

FIG. 5 is a flow chart illustrating rendering and reconstruction optionsin accordance with an embodiment of the present invention.

FIG. 6A illustrates an example of dithering sampling patterns to reducevisual artifacts in accordance with an embodiment of the presentinvention.

FIG. 6B illustrates a general method of performing dithering of samplepatterns in accordance with an embodiment of the present invention.

FIG. 7A illustrates an example of advection in accordance with anembodiment of the present invention.

FIG. 7B illustrates a general method of performing advection in agraphics system in accordance with an embodiment of the presentinvention.

FIG. 8 illustrates an example of using pre-computed weights to performcubic spline interpolation in accordance with an embodiment of thepresent invention.

FIG. 9 illustrates an example of sampling pattern related toconsiderations for determining pre-computed weights in accordance withan embodiment of the present invention.

FIG. 10 illustrates an example of sampling pattern related toconsiderations for determining pre-computed weights in accordance withan embodiment of the present invention.

FIG. 11 illustrates a general method of adaptive desampling inaccordance with an embodiment of the present invention.

FIG. 12 illustrates a general method of performing cubic splineinterpolation in a graphics system in accordance with an embodiment ofthe present invention.

FIG. 13 illustrates a general method of performing cubic splineinterpolation in a graphics system in accordance with an embodiment ofthe present invention.

FIG. 14 illustrates an example of differences between advection andspline reconstruction.

FIGS. 15A and 15B illustrates an example in which different regions of aframe are adaptively rendered using different approaches based on amagnitude of per-pixel velocity.

FIG. 16 illustrates an example of using advection for stereoscopicrendering in accordance with an embodiment of the present invention.

FIG. 17 illustrates adaptive rendering applied to foveated rendering inaccordance with an embodiment of the present invention.

DETAILED DESCRIPTION

Example Graphics Pipeline System Overview

FIG. 2 illustrates a graphics pipeline 200 in accordance with anembodiment of the present invention. The graphics pipeline 200 may beimplemented using a graphics processing unit (GPU) including graphicshardware. The graphics pipeline 200 includes several new stages andfunctions to support automatically determining regions of the frame thatdo not require all of the pixels in individual tiles (blocks of pixels)to be sampled and rendered in order to achieve an acceptable viewingexperience for a human user. As used in this application, a tile is acontiguous set of pixels in an image, typically in block having a squareshape. The term frame is commonly used to describe a set of operationsperformed to render an image that is read by a display at a presetfrequency. However, the term frame is also used to refer to the renderedimage resulting from the set of operations used to render the image.

In one embodiment, an adaptive desampling (AD) sample generator stage205 is provided to support adjusting a sampling pattern in local regionsof an image, where the local region is a tile corresponding to a blockof pixels (e.g., a 4×4 block of pixels, 16×16, or other size).Desampling is the reduction in the number of samples per tile that aresampled and rendered in the current frame. For example, desampling mayinclude sampling and rendering on average less than one sample per pixelin a tile, and thus may also be described as sub-sampling. To maintainfull image resolution, two different approaches may be used to obtainvalues of missing pixel data. A reconstruction and advection stage 210supports two different options to reduce the number of pixels that needto be sampled and rendered in a tile while maintaining visual qualityfor a user. The reconstruction and advection stage 210 includes areconstruction submodule 211 and an advection submodule 212. In oneembodiment, a first option to reduce the number of pixels rendered in atile is reconstruction via higher order polynomial interpolation andfiltering in a tile to generate missing pixel data for that tile. Asecond option to reduce the number of pixels rendered in a tile isadvection, which includes identifying locations of one or more pixels ina previous frame and reusing pixels from the previous frame for aselected fraction of pixels in the tile.

In one embodiment, pixel data of frame “n” 215 of objects from frame n220 is saved for possible reuse of pixel data in the next frame “n+1.”Additionally, vertex coordinate data is saved for use in determining aframe-to-frame motion vector of pixels. In one embodiment, the pixeldata and vertex coordinates from frame n are stored in a buffer memoryfor use in the next frame n+1.

FIG. 3 illustrates an AD sample stage 205 in accordance with anembodiment of the present invention. In one embodiment, desamplingdecisions are made in local tile regions based on velocity and edgedetection (e.g., edge detection in depth/Z). A velocity buffer 310receives the per vertex coordinates from the current fame and from theprevious frame. The velocity of an individual pixel may be determined bycomparing the vertex coordinates of the pixel of the current frame withthe vertex coordinates of the pixel in the previous frame. In oneembodiment, a forward splatting approach is used by rendering a“velocity image” with primitives from the scene, and using a per-vertexvelocity as a vertex attribute. Many graphics applications render aZ-buffer as a technique to reduce the number of pixel shader instancesduring rendering passes. A velocity buffer/image may be rendered with aZ-buffer. During the Z-pass, where the Z/depth buffer is generated, inaddition to splatting and updating the depth, the velocity is alsoupdated at each pixel. Rendering the velocity buffer results inper-pixel velocity values in screen space, the magnitude of whichcorresponds to a speed. A tile, such as a 4×4 tile, thus has a pixelspeed associated with each pixel. The tile thus has a maximum pixelspeed, mean pixel speed, median pixel speed, and minimum pixel speed. Inone embodiment, the mean pixel speed is used to make desamplingdecisions, although more generally the maximum pixel speed or averagepixel speed could also be used.

Visual artifacts are less perceptible to the human eye in movingobjects. Thus, one factor in whether or not a sampling rate may bereduced in a tile is whether the speed is above a threshold speed.

However, certain types of visual artifacts tend to be more noticeable inedges in color. Strictly speaking, detecting color edges in a finalimage is not possible without rendering the image first. However, it ispossible to detect, prior to rendering, a high likelihood of edges incolor. Thus, in one embodiment, an edge detection module 305 detects thelikelihood of edges in color in local blocks of pixels. That is, regionsare detected in which there is a high likelihood of edges in color byassuming that there is a high likelihood of color variation acrossobjects. In one embodiment, Z values from the rasterization of thecurrent frame are analyzed to perform edge detection. A Laplace edgedetector may be defined as stencil centered on a current pixel. Anypixel in the tile is marked as having an edge if the Laplacian of thez-buffer at the pixel is greater than a threshold value multiplied bythe z-value at the pixel. This defines a one bit value per tile. Moregenerally, any type of edge detection may be used.

In one embodiment, an edge mask is generated for individual tile and anedge state bit may be generated to indicate whether or not a tileincludes at least one edge. In one implementation the edge mask isgenerated for each 4×4 block of pixels although more generally othertile sizes may be used. This information on velocity and the presence ofan edge is used by a sample generator 315 to determine a sample patternfor a tile. In one embodiment, a full sampling resolution is utilized ifan edge is detected. If no edge is detected and a tile has a speedgreater than a first threshold speed a first reduced sampling rate isused. If no edge is detected and a tile has a speed above a secondthreshold speed a second reduced sampling rate is used. Other additionaloptional factors could also be considered in making a sampling ratedecision. In one embodiment, the sample pattern options include fullsample resolution (at least one sample per pixel), one-half resolution(one-half of the pixels sampled in each tile), and one-quarterresolution (one in four pixels sampled in each tile). More generally, aplurality of sampling rates may be provided that are controlled bythreshold parameters for each sample rate. Additionally, the samplerates selected may be optimized for the block/tile size selected. Thus,while an illustrative example includes three sample rates of 4, 8, and16 samples for 4×4 blocks, the approach may be varied based on blocksize or other considerations to have a set of sampling rates eachcontrolled by threshold parameters for each sample rate. Thus, thenumber of sampling rates, N, may be more than three, depending onimplementation details, such as block/tile size and other factors.

In one embodiment, a dithering module 320 is provided to adjust thesampling pattern from a selection of sampling patterns having the sameeffective sampling rate. The dithering may be a repetitive sequence(e.g., sample pattern 1, sample pattern 2, sample pattern 3, samplepattern 4) or include aspects of randomization.

The dithering of the sampling pattern by the dithering module 320reduces the visual perception of sampling artifacts by human users. Thehuman eye and the human brain starts to blend images into a videosequence when the rate is faster than a biological threshold. That is,when images vary at a rate faster than a biological threshold, the humaneye blends the images across time and perceives them as a continuouslyvarying sequence, akin to a video. There is some contention about whatthe exact number of the biological threshold is. At frame rates of about12 frames per second, the human eye and brain begins to see a sequenceof images that is moving instead of individual images. However, somewhathigher frame rates of about 15 frames per second are required toexperience the beginnings of relatively fluid (non-jerky) movement.However, the nature of the underlying images is also an additionalfactor for whether or not a human observer perceives a fluid motion at agiven frame rate. Thus, the human eye will tend to average out visualartifacts that are dithered at frames rates at about 12 frames persecond and higher. In one embodiment, the dithering is performed suchthat every pixel is rendered at least fifteen frames per second, whichis faster than the human eye can discern individual images. At 60 framesper second, dithering the sample pattern in a tile every four framescorresponds to rendering each pixel at least fifteen frames per second.

Exemplary Motion Speed Regimes

FIG. 4 illustrates examples of speed regimes in accordance with anembodiment of the present invention. The motion is the combination ofobject motion and camera motion. The speed corresponds to the magnitudeof the motion vector in a tile. In this example, the speed is anindicator of the number of samples needed in a block of pixels to havean acceptable visual quality. If the motion if above a certain thresholdspeed K_(fast1) for a block of pixels, it is an indication that thenumber of samples may be decreased (e.g., eight samples in a 4×4 tile)because the human eye cannot perceive the high frequencies in a movingobject. If the speed is above an even higher threshold speed K_(fast2),it is an indicator that the number of samples in a tile may be reducedeven further (e.g., four samples in a 4×4 tile). On the other hand, ifthe motion is very slow in a tile, below a speed K_(stat) (or if thereis no motion), then there may be an opportunity to reuse pixel data fromthe previous frame (e.g., render eight samples in a 4×4 tile and reuseeight color values from the previous frame via advection). The reuse ofpixel data from the previous frame also requires that the graphics statedoes not change from the previous frame to the current frame, where thegraphics state includes the shaders used, the constants provided to theshaders, and the geometry provided to the frames. There will be a speedregime where full sampling resolution is required. As an example, theremay be an intermediate speed regime between K_(stat), and K_(fast1) inwhich a full sampling resolution is required to achieve a high visualquality. Additionally, there may be scenarios in which super-sampling isapplied to individual tiles. As an illustrative example, an option maybe provided to support super-sampling of a Z-edge case.

In one embodiment, desampling (changing the sample pattern to reduce thesampling rate below one sample per pixel) is permitted if the speed isabove a first threshold speed K_(fast1). In one embodiment, the samplingrate is permitted to be reduced further if the speed exceeds a secondthreshold speed K_(fast2). A decision whether to perform desampling mayalso be dependent on other conditions, such as whether or not an edge isdetected.

In one embodiment, motion in the camera screen space is obtained bydifferencing vertex position data from the current frame and theprevious frame. A speed regime of a tile is classified on a tile-by-tilebasis by calculating a magnitude of a motion vector based on how much apixel of an object has moved from one frame to another. As previouslydiscussed, in one embodiment, splatting is used in the Z-pass todetermine per-pixel motion vectors. In one embodiment, speed thresholdsare defined and used as inputs to make decisions on whether adaptivedesampling or advection are to be used for a current frame. One speedregime is a quasi-static regime in which an object moves slowly enoughthat pixels of the object are unlikely to differ significantly fromtheir previous image counterparts. If the speed is within the quasistatic speed limit, a decision may be made whether advection may be usedto reuse pixels from a previous frame. In one embodiment, an upper boundon a quasi-static speed, K_(stat) is that a pixel in a given tile (tilem) in frame n remains in the same tile in frame n+1. In one embodiment,if the speed is below K_(stat), additional checks are performed todetermine if pixels from the previous frame may be used in the currentframe. This may include a check that advection produced an acceptableresult in a previous frame. Additionally, a check may be performed tocheck that the pixel values for the tile in the current frame areconsistent with a small movement over the previous frame, which may bedescribed as a discrepancy check. An advection discrepancy state bit maybe associated with a tile to indicate that it has passed one or morediscrepancy checks to confirm that the tile is suitable for advection ofat least some of the pixel data.

FIG. 5 is a flowchart illustrating an example of adaptive renderingchoices based on speed, edge detection, dithering, spline reconstructionand advection. Some conventional graphics pipeline features are omittedfor clarity. FIG. 5 illustrates a specific example in which 4×4 tilesare used in accordance with an embodiment of the present invention. Aninitial pre-pass may be performed followed by a color pass to renderpixel data. The scene geometry 505 of an image is provided by theapplication. The Z-buffer is computed 510 and edge detection isperformed 515. Motion vectors are computed 520 for the scene geometry.The per-pixel motion vector is computed 525. The range of motion in atile is computed 530. Based upon this information, a decision 535 ismade whether to: 1) render 4, 8, or 16 samples in a 4×4 block 535 andperform interpolation or 2) to render 8 and advect 8. Dithering 540 isperformed for the sampling patterns. Spline reconstruction 545 isutilized to reconstruct pixel data. If advection is used, then advection550 is used to obtain 8 of the pixel values and the rest are obtained byrendering.

Exemplary Sampling Patterns and Dithering

FIG. 6A illustrates an example of sampling patterns and dithering. Inthis example the tile size is a 4×4 block of pixels. Full resolutioncorresponds to 16 samples. Half-resolution (8 samples) and one-quarterresolution (four samples) permits variations in the pattern of thesamples. Thus, for the case of 8 samples, the arrangement of the samplescan have a first sample pattern, second sample pattern, third samplepattern, etc. Having pre-defined sampling patterns supports dithering ofthe sample pattern for temporal color averaging. The pre-definedsampling patterns are selected to rotate the sampling so that everypixel location is rendered once every few frames. The dithering of thesample pattern can be achieved by different techniques. In oneembodiment, the choice of sample pattern in an individual frame can beselected by the dithering module 320 in a sequence by a modulo kcounter. Dithering sample positions in time over multiple frames makesrendering errors harder for a human observer to see. In one embodiment,the sample patterns are selected so that each pixel is guaranteed to berendered at least once every k frames, where (n*n)/k is the minimumnumber of samples per n×n tile. In another embodiment, temporaldithering is implemented using a stochastic approach to select thesample pattern.

FIG. 6B illustrates a method of dithering in accordance with anembodiment of the present invention. Tiles in a current frame areselected 605 for sub-sampling at a reduced average sampling rate. Foreach tile, a sampling pattern is selected 610 to be varied over theprevious frame. Rendering and reconstruction is performed 615. Ifadditional frames are to be rendered, the process continues.

ADVECTION EXAMPLE

FIG. 7A illustrates an example of advection. In a tile region, such as a4×4 tile 700, advection including copying pixel data from pixel at agiven location in the previous frame to the corresponding location inthe current frame. For example, an individual object (e.g., a ballslowly moving across the ground) may move across the screen such thatevery pixel of the ball moves with a velocity. In this example there isa high level of temporal coherence between the pixels of the slowlymoving ball from one frame to another. In this case, the changes areprimarily motion. By determining the motion of individual pixels of theball across frames, pixel data may be copied across frames. In thisexample, the motion is slow enough that pixel data can be mapped form acurrent pixel location to a pixel in the same tile in a previous frame.The position of a pixel in a previous frame may be computed asx(n−1)=x−mv(x), where mv(x) is the motion vector. As a result thispermits pixel data to be copied from x (n−1) to x(n). That is, if themotion of the pixel is small between frames then the pixel location inthe current frame may be projected back to a pixel in the previous frameand the pixel data from the previous frame copied. Bilinear or anyhigher order interpolation may be used if x(n−1) has decimal components.

In the example of FIG. 7A, advection is mixed with rendering. In oneembodiment, advection is used for half of the pixels 705 in a tile andthe other half of the pixels are rendered 710. Mixing advection andrendering in a single frame reduces visual artifacts associated withperforming only advection. That is, it minimizes the likelihood ofvisual errors due to advection detectable by typical human viewers. Inconjunction with temporal dithering, it ensures that errors do notaccumulate over time, thus reducing the likelihood of visual errorsbeing noticed by typical human viewers. While a 1:1 ratio of renderedpixels and advected pixels is one option, more generally other ratioscould be utilized.

As previously discussed, in one embodiment, a maximum speed is used ascondition for whether advection is permitted. In one embodiment, thecriteria is that the threshold speed is low enough that localdeformation of pixel positions in a small neighborhood can be classifiedas a rigid transformation in which the change in the positions of thepixels can be represented using one of translation and one rotation foran entire set of pixels to within a desired accuracy. For example, themaximum speed for advection can be that the magnitude of the pixelmotion is below a threshold of k pixels. While it is possible that rigidtransforms can occur at any speed, the likelihood decreases withincreasing speed such that a speed threshold may be used as a criterionfor when advection is likely to be beneficial. A discrepancy check maybe performed for individual tiles to determine whether or not advectionproduces acceptable results. This discrepancy check can be performed ina current frame and written out as 1-bit value for each tile to let thenext frame make a determination whether or not to disable advection inthe neighborhood of a tile failing the discrepancy check if the checkindicates that the advected results were inaccurate. That is, in thisimplementation advection is performed for a tile in frame n and thediscrepancy check is performed in frame n and consumed by frame n+1.Frame n+1 then uses the discrepancy check (computed in frame n) todetermine whether or not to perform advection in a neighborhood about atile in frame n+1. If the discrepancy check in frame n indicates theadvection result was acceptable, advection is allowed in frame n+1. Ifnot, the advection is turned off for a selected number of frames. Thediscrepancy check is a check based on whether or not there is asignificant change in pixel values of a tile inconsistent with theunderlying assumptions of valid advection. If the pixels of an objectare slowly moving then a tile is not expected to change significantlybetween two frames. Thus, if the state of the tile changes significantlythe discrepancy check fails. A tile state discrepancy bit (e.g., 0 or 1)may be used to indicate whether the discrepancy check passes. The degreeto which changes in tile state are permitted may be determinedempirically or heuristically based, for example, in the tradeoffsbetween the computational benefits of advection and minimizing theappearance of visual artifacts.

Other ways of performing discrepancy checks may be utilized. There arecomputational benefits to performing advection in a tile of currentframe n, performing a discrepancy check, and then utilizing thediscrepancy check to determine whether or not to perform advection inframe n+1. However, it will be understood that an alternateimplementation of the discrepancy check may be utilized in which thediscrepancy check is performed in frame n and used to determine whetheror not to utilize advection in frame n to reuse pixels from the previousframe.

The accuracy can be improved, if desired, using various enhancements. Inone embodiment, back and forth error correction and compensation (BFECC)is used. BFECC utilized the position determined from Semi-Lagrangianadvection and adds the velocity at that coordinate to obtain a newposition in the current frame. If there is no error, this coordinateshould be the same as the original position (x, y). Otherwise bysubtracting half of this error from (x−v_(x), y−v_(y)) the second-orderaccurate estimate of the position is obtained, which is accurate to halfa pixel, assuming that the velocity is pixel accurate.

FIG. 7B illustrates a general method of performing advection inaccordance with an embodiment of the present invention. A determinationis made 1405 if the tile is suitable for advection. The suitability isbased on whether the speed range is within the quasi-static range,augmented by passing any additional discrepancy checks. If the tile issuitable for advection, then a determination is made in block 1410 ofcorresponding pixel locations in the previous frame. A selected fractionof pixels are reused 1420 from a tile of a previous fame. The remainingpixels are rendered 1425.

Image Interpolation and Reconstruction Examples

FIG. 8 illustrates an example of image interpolation and reconstructionof pixel color values for the situation of desampling. In oneembodiment, a weighted summation of color values is used to reconstructunrendered pixels. For a given choice of the weight function w, anormalized set of weights can be precomputed for each configuration ofpixels arising from a particular sampling pattern. For example, if 4pixels are rendered in a 4×4 block, the remaining 12 pixels can beexpressed using a weighted sum of rendered pixels within the same block,as well as its neighboring blocks. In addition, since the set ofpossible pixel configurations in the neighboring blocks is restricted bythe set of sampling patterns, for this case, all possible weight setscan be precomputed.

Traditionally, a GPU utilizes bilinear interpolation. However, bilinearinterpolation has various drawbacks. In one embodiment higher orderpolynomials having an order of at least three, such as piece-wise cubicpolynomials (also known as cubic splines), are used for efficientreconstruction of sparse samples.

Higher order polynomials, such as cubic splines, are capable of mappinga larger frequency spectrum than bilinear interpolation and provide agreater fidelity of data reconstructed from sub-sampled blocks.Additionally, when using bilinear interpolation, samples are preferredon both sides of a pixel, as one-sided linear extrapolation is likely tobe inaccurate, as well as exceed the color spectrum range. In contrast,higher-order polynomials using a wider support (>1 pixel away) are morelikely to accurately approximate the functional form of rendered imagedata. While a variety of higher order polynomials could be used, a cubicspline has continuity characteristics that are superior to those ofquadratic polynomials. Owing to the edge-detection step performed beforedesampling, a tile undergoing reconstruction is unlikely to have sharpdiscontinuities, where higher-order polynomial reconstruction mayperform poorly.

One aspect of performing sub-sampling is that there is a sparse sampledata at runtime. In an individual block region, such as a k×k pixelregion, desampling may result in a subset of pixels being rendered, suchas four or eight pixels from a 4×4 block of pixels. The missing pixeldata needs to be reconstructed. A consequence of having predeterminedsample patterns is that there is a finite set of possible samplelocations. This permits a fixed set of local stencils to be createdprior to run time, stored, and used to reconstruct pixel data usingcubic splines or other higher order polynomials. Conventional approachesto evaluating higher order polynomials in hardware are computationallyexpensive. In contrast, in embodiments of the present invention the useof a fixed set of pre-computed stencils eliminates the computationaloverhead, during runtime, of performing a conventional higher orderpolynomial evaluation. The use of a static set of samples allows thedetermination of possible configurations of pixels that may need to bereconstructed, and thus the stencils that are required may bepre-computed.

In one embodiment, the higher order polynomial interpolation isimplemented as static stencil operations using pre-computed weights. Inone embodiment, a table of stencils is stored and made available forspatial reconstruction to a reconstruction submodule 211 of thereconstruction and advection stage 210. The table of stencils providesweights based on known sample positions. In one embodiment, the table ofstencils has all of the stencil weights pre-computed for each pixellocation within a defined sample pattern. The pre-computed weightspermit the higher order polynomial reconstruction to be performed usingstatic stencil operations.

In one embodiment, a set of 5×5 stencils is determined for all possiblepixel locations in a tile (e.g., a 4×4 tile) that may need to beinterpolated during runtime. Each 5×5 stencil is computed for each pixellocation and neighbor configuration. Each stencil provides a list ofweight values and corresponding locations of sample points. The stencilsare stored in a constant memory table available for reconstructionpurposes to the reconstruction submodule 211 of reconstruction andadvection stage 210. In one embodiment, at run-time, for each pixel thatmust be interpolated, an index is computed into this table using thepixel coordinates and sampling mask. In one implementation each stencilis addressed using: (a) the pixel's location within a tile, and (b) thesampling mask used for rendering. Thus, if dithering is employed, thestencil that is selected will depend on which sample pattern is selectedfor a given degree of subsampling.

In one embodiment, the higher order polynomial interpolation isperformed using a multiplier/adder to accumulate the products of weightsand sample color values. The accumulated value is then normalized bydivision, which in many cases can be performed by a bit shift forinteger formats, or by subtraction for floating point formats. Thus, theuse of stencils with pre-computed weights permits the higher orderpolynomial interpolation to be calculated at run time with comparativelylittle computational effort.

An example of a cubic spline functions used for reconstruction and tocompute pixel color values as a weighted sum of known pixel color valuesis as follows:

In one embodiment, a formula expressing a weighted sum to determine apixel color value is based weights w( ) as follows:

${c\left( {i,j} \right)} = \frac{\sum\limits_{{\{{a,b}\}} \in {Filled}}{{w\left( {{i - a},{j - b}} \right)}{c\left( {a,b} \right)}}}{\sum\limits_{{\{{a,b}\}} \in {Filled}}{w\left( {{i - a},{j - b}} \right)}}$

Where c (i, j) is the color value at pixel location (i, j), w( ) is thetwo dimensional spline function and “Filled” is the set of pixels thatwere rendered. The two-dimensional spline function is the product of twoone-dimensional spline functions or w(i, j)=k(i)k(j), where the onedimensional spline function k( ) is based on the cubic filter formuladescribed in the paper by Don P. Mitchell and Arun N. Netravali,“Reconstruction Filters in Computer Graphics,” Computer Graphics, Volume22, Number 4, August 1988, pp. 221-228:

${k(x)} = {\frac{1}{6}\left\{ \begin{matrix}\begin{matrix}{{\left( {12 - {9B} - {6c}} \right){x}^{3}} +} \\{{\left( {{- 18} + {12B} + {6C}} \right){x}^{2}} + \left( {6 - {2B}} \right)}\end{matrix} & {{{if}\mspace{14mu}{x}} < 1} \\\begin{matrix}{{\left( {{- B} - {6C}} \right){x}^{3}} + {\left( {{6B} + {30C}} \right){x}^{2}} +} \\{{\left( {{{- 12}B} - {48C}} \right){x}} + \left( {{8B} + {24C}} \right)}\end{matrix} & {{{if}\mspace{14mu} 1} \leq {x} \leq 2} \\0 & {otherwise}\end{matrix} \right.}$

The distances in the Mitchell and Netravali paper are defined in ascaled pixel space:B=C=⅓

By restricting the relative positioning of sample points, the weightsand denominators can be pre-computed into stencils. Because the splinefunction is defined in a bounded fashion, scaling of the magnitude of xcan be used to extend the functions to a desired support radius, such asa 2 pixel support radius.

For a tile of size n×n, it is possible to arrange a k×k square in(n/k)*(n/k) possible configurations. A sampling rate of 4*s requires ssquares, leading to (n*n)/(k*k*s) sampling patterns.

FIG. 9 illustrates an example of sampling pattern in a 4×4 tile in whichthe Xs mark rendered samples and the O marks an interpolation location.A 5×5 stencil is used that is centered at O. Assuming any access outsidethis 4×4 tile is invalid, the stencil has 0 weights for any locationsoutside the 4×4 tile, which are removed from the stencil table. Assumingthe top left pixel to be (0, 0), the table entry then reads thelocations required as (0, 0), (2, 0), (0, 2), (2, 2), with appropriateweights w0, w1, w2, w3, and the normalization factor w. The weightedsummation can then be computed as 1/w (w0*c(0, 0)+w1*c(2, 0)+w2*c(0,2)+w3*c(2, 2)) for each color component by using amultiply-and-accumulate operation. However, more generally, thereconstruction is not limited to one tile but a region of influence of astencil may extend to neighboring 4×4 blocks as well.

Assuming a 5×5 stencil, there are 24 values in all to be pre-computed(the center is always 0 since the pixel itself has no color value). Ofthose, at most half can be rendered if 8 samples are used per 4×4 tile,leaving 12 values. In one embodiment, each stencil is implemented toinclude a 4-bit count of the number of non-zero weights, followed by8-bit weights stored in one chunk, followed by 2 chunks of 3-bitcoordinate offsets for the x and y coordinates relative to the center.

In one embodiment, the stencils are stored in order of the samplingpatterns. In one embodiment the different sampling patterns for the samesampling rate are rotations of each other, so there are two sets ofpatterns. These can be stored in row major order within a 4×4, with anindex list to point to the data for pixel (i, j). For rotations of thesampling mask, the coordinates are transformed appropriately.

Referring to FIG. 10, consider the case of a 4×4 tile of pixels, inwhich 8 samples out of the possible 16 are rendered. In this example,stencils are defined for each unknown pixel given the weight function.These stencils can be retrieved at runtime from a pre-defined set ofstencils. For the example case of cubic stencils with a support radiusof 2 pixels, these stencils would be of size 5×5 if no super-sampling isperformed. If it is essential to restrict accesses to a k×k tile region,the stencils can be modified appropriately to have 0 weights for suchpixels which fall outside the tile. It is important to note that thenumber of samples does not need to be less than the number of pixels. Inregions where super-sampling is desired for anti-aliasing, the number ofsamples may exceed the number of pixels, e.g. 32 samples for a 16 pixel4×4 tile. Appropriate pre-computed stencils would be added for thosecases.

In one embodiment, each sampling pattern is defined as combination ofsparse square patterns (e.g., four samples to be rendered in a squarepattern). Selecting square patterns is useful in applications in whichgroups of four pixels (quads) are a default unit of processing. However,more generally other arrangements of sampling positions could be used inthe sampling patterns. In one embodiment, the sample patterns aresquares of size 3×3 within a 4×4 tiles. Thus, adjacent vertices are 2pixels apart along each axis.

In one embodiment, the same sampling pattern is used for all regions ofan individual frame that are sub-sampled at a given sampling rate. Inthis embodiment, the same sampling pattern is used in all of the tilessub-sampled at a given sample rate because this results in consistentspacing of sample positions within every frame, simplifyingreconstruction routines.

In one embodiment, the sampling patterns are based on quads to exploitSingle instruction multiple data (SIMD) processing units. Consistentspacing of samples provides robust interpolation and aids in achievingfull pixel resolution in a final image.

FIG. 11 illustrates a general method of adaptive desampling and splineinterpolation in accordance with an embodiment of the present invention.A determination is made 1005 if the speed range of the tile is withinthe speed range for sub-sampling and a check is made for the presence ofedges. A determination 1010 is made of the sub-sampling rate and asample pattern is chosen. The pixels of the tile are shaded 1015 basedon the sampling pattern. Reconstruction is performed 1020 to interpolatemissing pixel values, where spline interpolation may be performed.

FIG. 12 illustrates a method of performing cubic spline interpolation inaccordance with an embodiment of the present invention. A tile isselected for sparse sampling 1105. A sample pattern is selected 1110.Pixels are rendered 1115 for the sampled locations. Reconstruction isperformed of missing pixel data via cubic spline interpolation based onpre-computed weights 1120.

FIG. 13 illustrates a method of utilizing stencils containingpre-computed weights in accordance with an embodiment of the presentinvention. Pre-computed weights are generated for each missing pixellocation in a sample pattern 1205. A stencil containing the pre-computedweights is stored 1210. The stored stencil is accessed during runtime1215. The accessed stencil I used to perform cubic spline interpolation1220.

Example Comparison of Advection and Reconstruction

FIG. 14 illustrates an example of aspects of advection andreconstruction via cubic splines. The tile size is a 4×4 tile size. Thepixel pattern in the previous frame is a checkerboard pattern. Therendered pixel values are denoted by an R. In the example on the left,advection is performed to reuse half of the pixel color data from theprevious frame in a 4×4 tile. The velocity associated with the tile isvery low and half of the pixels are advected by copying them from pixelvalues of the previous frame. Arrows are shown for four of the pixels toindicate reuse of pixel data from the same tile in the previous frame.In this case the color information is copied with no bleeding of color.In the example on the right there is a significant tile speed,corresponding to a half-pixel displacement per frame. In this examplereconstruction is performed based on cubic spline interpolation. Thevelocity along x a 0.5 pixels leads to each rendered pixel having greyexactly halfway between black and white. The reconstructed pixels thushave the same value. That is, the color values are correct, and a fullresolution render would also create the same values.

Automatic Tile-by-Tile Adaptive Rendering Example

FIG. 15A illustrates an example of a frame in which the scene hasregions in which the pixel velocity differs from other regions and someregions include color edges. As an example, the scene may include arider on a motorcycle as well as stationary objects and quasi-stationaryobjects, such as plants moving slowly in the wind. Thus, there areregions that can be classified in different speed regimes. Consequently,as indicated by the boxes in FIG. 15B, different regions of the scenehave different pixel velocities, with some of the regions providingdifferent opportunities for adaptive rendering. As a result, in anindividual frame the system automatically analyzes individual tiles andmakes a determination on a tile-by-tile basis whether to desample andperform advection, desample and perform cubic spline interpolation, orutilize a normal default sampling scheme. Individual decisions may alsobe made on a tile basis whether or not to perform super-sampling. As thesystem automatically performs this optimization, no special inputs froman application developer are required, assuming relevant parametervalues are defined separately.

Stereoscopic Rendering Example

Embodiments of the present invention may be used to generate a single(non-stereoscopic) display. However, it may also be applied tostereoscopic rendering for virtual reality applications. Referring toFIG. 16, consider the case where separate images are generated for eacheye, corresponding to a left eye image and a right eye image. Advectionmay be used to improve the efficiency of the stereoscopic rendering. Inone embodiment a left image is generated. A translation motion,motion_(trans), is defined as the translation to transform portions ofthe left-eye image to a right eye image. In one embodiment, the samplegenerator decision making is augmented to make a sampling decision forthe right image to attempt to advect pixel values from the left image.In one embodiment, the sampling is Z-based and a test is performedwhether a minimum Z of the left image and right image are greater than athreshold Z. If the min (Zleft, Zright)>Zthresh, pixels are advectedfrom the left frame to the right using the motion_(trans). Otherwiserendering is based on the motion based sampling rate. As illustrated inFIG. 11, this results in the right eye image being a combination ofadvected pixels from the left-eye image and rendered pixels.

Foveated Rendering Using Adaptive Rendering

FIG. 17 illustrates an embodiment in which adaptive rendering is appliedto foveated rendering. The structure of the human retina of the eye hasa fovea portion that provides the highest visual acuity in a healthyhuman eye. The greatest visual acuity of a healthy human eye is within asmall cone of angles and drops off with increasing angular distance.Foveated rendering renders higher detail near where the user is lookingand lowers the detail further from the focus point. FIG. 17 illustratesa focal point (x,y) 1725. The sampling rate is decreased with increasingradial distance from the focal point (e.g., 1/(distance from the focalpoint). The decrease may be performed in a stepwise fashion at specificradial distance. For example, a specific number of samples may berendered in a circular region 1720 up to a radial distance r0 1715. Alower number of samples are rendered in the annular region 1710 from r0to r1 1705. An even lower number of samples are rendered in the regionhaving a radial distance greater than r1. As an illustrative example, 16samples may be rendered in the region between (x,y) and r0, 8 samplesrendered in the region between r0 and r1, and 4 samples in the regionbeyond r1. More generally other radially varying sampling functions maybe used.

While the invention has been described in conjunction with specificembodiments, it will be understood that it is not intended to limit theinvention to the described embodiments. On the contrary, it is intendedto cover alternatives, modifications, and equivalents as may be includedwithin the spirit and scope of the invention as defined by the appendedclaims. The present invention may be practiced without some or all ofthese specific details. In addition, well known features may not havebeen described in detail to avoid unnecessarily obscuring the invention.In accordance with the present invention, the components, process steps,and/or data structures may be implemented using various types ofoperating systems, programming languages, computing platforms, computerprograms, and/or computing machines. In addition, those of ordinaryskill in the art will recognize that devices, such as hardwired devices,field programmable gate arrays (FPGAs), application specific integratedcircuits (ASICs), or the like, may also be used without departing fromthe scope and spirit of the inventive concepts disclosed herein. Thepresent invention may also be tangibly embodied as a set of computerinstructions stored on a computer readable medium, such as a memorydevice.

What is claimed is:
 1. A method of graphics processing, comprising:selecting, on a frame-by-frame basis for a sequence of frames, aselection of a set of tiles in which the tiles are sparsely sampled atan average sample rate of less than one sample per pixel; selecting, bya graphics processing unit, in each frame, a sampling pattern for eachsparsely sampled tile selected from a set of different sampling patternshaving the same average sampling rate; and varying, by the graphicsprocessing unit, the sampling pattern in individual tiles over asequence of frames to temporally color average sampling artifacts. 2.The method of claim 1, wherein the sampling pattern is varied at a rateabove a threshold for human perception to discern individual images. 3.The method of claim 1, further comprising selecting, on a frame-by-framebased for a sequence of frames, full sampling for a second set of tilesin which the tiles are sampled at a rate at least equal to one sampleper pixel.
 4. The method of claim 3, further comprising: analyzing ascene to determine a minimum number of samples per tile in each regionof an image and selecting a sample rate and a sample pattern for eachtile.
 5. The method of claim 4, wherein a sampling pattern is determinedfor each tile prior to pixel shading.
 6. The method of claim 1, whereinin a particular frame, the same sampling pattern is utilized for allsparsely sampled tiles having the same sample rate.
 7. The method ofclaim 1, wherein the sampling pattern is scheduled by a counter toensure that the refresh rate is above a threshold human perception todiscern individual images.
 8. The method of claim 1, wherein thesampling pattern is varied over a sequence of frames in a scheduleselected to ensure that every pixel is sampled at least once over a setof frames.
 9. The method of claim 1, wherein the sampling pattern isstochastically varied over a sequence of frames.
 10. A method ofgraphics processing, comprising: determining by a graphics processingunit, in each frame, a required minimum sample rate for each tile of aframe and selecting a sample rate for each tile in the frame; selectingby the graphics processing unit, in each frame, a sampling pattern foreach tile that is sparsely sampled at a selected sampling rate of lessthan one sample per pixel, the sampling pattern being selected from aset of different sampling patterns having the same selected samplingrate but a different arrangement of sample locations; and varying by thegraphics processing unit the sampling pattern in individual tilelocations over a sequence of frames to temporally color average samplingartifacts associated with sparse sampling.
 11. The method of claim 10,wherein the sampling pattern is varied at a rate above a threshold forhuman perception to discern individual images.
 12. The method of claim11, wherein the sampling pattern is varied at a rate at least equal to15 frames per second.
 13. The method of claim 10, wherein in aparticular frame, the same sampling pattern is utilized for all sparselysampled tiles having the same sample rate.
 14. The method of claim 10,wherein the sampling pattern is scheduled by a counter to ensure thatthe refresh rate is above a threshold human perception to discernindividual images.
 15. The method of claim 10, wherein the samplingpattern is varied over a sequence of frames in a schedule selected toensure that every pixel is sampled at least once over a set of frames.16. The method of claim 10, wherein the sampling pattern isstochastically varied over a sequence of frames.
 17. A graphics systemincluding a graphics pipeline, comprising: an adaptive sample generatorconfigured to adapt a sampling rate of individual tiles based on arequired sampling rate; and a dithering unit, the dithering unit varyinga sampling pattern utilized by the adaptive sample generator to sampletiles at an average sample rate of less than one sample per pixel. 18.The graphics system of claim 17, wherein the sampling pattern isselected from a set of sample patterns having a different arrangement ofsample locations and the sampling pattern is scheduled by a counter toensure that the refresh rate is above a threshold human perception todiscern individual images.
 19. The graphics system of claim 17, whereinthe sampling pattern is varied over a sequence of frames in a scheduleselected to ensure that every pixel is sampled at least once over a setof frames.
 20. The graphics system of claim 17, wherein the adaptivesample generator determines the required sampling rate in each tilebased on a motion vector of pixels in the tile.
 21. The graphics systemof claim 20, wherein the adaptive sample generator determines therequired sampling rate in each tile based on the combination of a motionvector of pixels in the tile and the presence of edges.
 22. The graphicssystem of claim 20, wherein the sampling pattern is dithered,interpolation is used to reconstruct missing pixel data, and thedithering reduces a visual appearance of artifacts associated withinterpolation.
 23. The graphics system of claim 20, wherein the samplingpattern is dithered, advection is performed to use pixel data from aprevious frame to generate pixel data for missing pixel values, and thedithering reduces a visual appearance of artifacts associated withadvection.